home *** CD-ROM | disk | FTP | other *** search
/ World Tours: Brazil / WorldTours: Brazil.iso / mac / content / main.dir / 00049_Script_movie < prev    next >
Text File  |  2007-04-22  |  6KB  |  232 lines

  1. global chapterCount,firstChapter,curChapter,QuestionCount,QuestionUsed,QuestionList,flvFile,quitToWhere
  2. global quesShowList,ansShowList,curQuesNum,ansList,bingoNum
  3.  
  4. on prepareMainMenu
  5.   pMember=member(3, "external files")
  6.   repeat with i=1 to the number of members of castLib("config")
  7.     member(i, "config").text=pMember.line[i]
  8.   end repeat
  9.   if the runmode contains "plugin" then
  10.     member("quit", "config").text=member("close", "config").text  
  11.   end if
  12.   
  13.   pMember=member(1, "external files")
  14.   n=pMember.line.count
  15.   repeat with i=1 to n
  16.     if pMember.line[i]="" then n=n-1
  17.   end repeat
  18.   chapterCount=n/2
  19.   firstChapter=1
  20.   curChapter=1
  21.   
  22.   pMember=member(2, "external files")
  23.   temp=value("["&pMember.line[1]&"]")
  24.   QuestionUsed=temp[1]
  25.   QuestionCount=temp[2]
  26.   QuestionList=[]
  27.   repeat with n=0 to QuestionCount-1
  28.     tempList=[#Ques:formatText(pMember.line[n*5+3]), #Ans1:pMember.line[n*5+4], #Ans2:pMember.line[n*5+5], #Ans3:pMember.line[n*5+6]]
  29.     append(QuestionList, tempList)
  30.   end repeat
  31.   
  32.   reflashChapterList()
  33. end
  34.  
  35. on reflashChapterList
  36.   pMember=member(1, "external files")
  37.   repeat with i=1 to 9
  38.     ChapterNo=firstChapter+i-1
  39.     if ChapterNo<=chapterCount then
  40.       member("CP"&i).text=pMember.line[2*ChapterNo-1]
  41.       member("CPTxt"&i).text=pMember.line[2*ChapterNo]
  42.     else
  43.       member("CP"&i).text=""
  44.       member("CPTxt"&i).text=""
  45.     end if
  46.   end repeat
  47. end
  48.  
  49. on refalshChapterContent
  50.   pMember=member(1, "external files")
  51.   member("chapter caption1").text=pMember.line[2*curChapter-1]
  52.   member("chapter title").text=pMember.line[2*curChapter]
  53.   member("chapter caption2").text=member("chapter caption1").text
  54.   if the machinetype = 256 then
  55.     flvFile=the moviepath&"movie\cp"&curChapter&".flv"
  56.   else
  57.     flvFile=the moviepath&"movie:cp"&curChapter&".flv"
  58.   end if
  59.   pMember=member("chapterContent")
  60.   
  61.   if member(curChapter,"chapter").type = #empty then
  62.     alert "This chapter file can not be found."
  63.     go "main"
  64.     return false
  65.   else
  66.     pMember.text=member(curChapter,"chapter").text
  67.     --  pMember.boxtype=#scroll
  68.     --  sprite(21).setFlvFile()
  69.     --  pMember.width=236
  70.     --  pMember.height=310
  71.     return true
  72.   end if
  73.   
  74. end
  75.  
  76.  
  77. on gotoPreChapter
  78.   curChapter=curChapter-1
  79.   if curChapter<1 then curChapter=1
  80.  
  81.   if refalshChapterContent() then sprite(21).setFlvFile()
  82. end
  83.  
  84. on gotoNextChapter
  85.   curChapter=curChapter+1
  86.   if curChapter>chapterCount then curChapter=chapterCount
  87.   
  88.   if refalshChapterContent() then sprite(21).setFlvFile()
  89.   
  90. end
  91.  
  92. on reflashQuiz
  93.   member("quesCaption").text=member("quiz caption").text&" #"&curQuesNum&":"
  94.   member("quesContent").text=QuestionList[quesShowList[curQuesNum]].ques
  95.   member("ans1").text=getprop(QuestionList[quesShowList[curQuesNum]], #ans&ansShowList[curQuesNum][1])
  96.   member("ans2").text=getprop(QuestionList[quesShowList[curQuesNum]], #ans&ansShowList[curQuesNum][2])
  97.   member("ans3").text=getprop(QuestionList[quesShowList[curQuesNum]], #ans&ansShowList[curQuesNum][3])
  98. end
  99.  
  100. on prepareQuiz
  101.   quesShowList=[]
  102.   tempList=[]
  103.   repeat with i=1 to QuestionCount
  104.     append(tempList,i)
  105.   end repeat
  106.   repeat with i=1 to QuestionUsed
  107.     n=random(tempList.count)
  108.     append(quesShowList, tempList[n])
  109.     deleteAt(tempList, n)
  110.   end repeat
  111.   
  112.   ansShowList=[]
  113.   repeat with j=1 to QuestionUsed
  114.     ansList=[]
  115.     tempList=[1,2,3]
  116.     repeat with i=1 to 3
  117.       n=random(tempList.count)
  118.       append(ansList, tempList[n])
  119.       deleteAt(tempList, n)
  120.     end repeat
  121.     append(ansShowList, ansList)
  122.   end repeat
  123.   
  124.   curQuesNum=1
  125.   ansList=[]
  126.   repeat with i=1 to QuestionUsed
  127.     append(ansList, 0)
  128.   end repeat
  129.   
  130.   bingoNum=0
  131.   member("right num").text=bingoNum&&"/"&&QuestionUsed
  132.   member("right rate").text="0 %"
  133. end
  134.  
  135. on formatText str
  136.   outStr=""
  137.   the itemDelimiter="^"
  138.   n=str.item.count
  139.   repeat with i=1 to n
  140.     if i=n then
  141.       outStr=outStr&str.item[i]
  142.     else
  143.       outStr=outStr&str.item[i]&RETURN
  144.     end if
  145.   end repeat
  146.   return outStr
  147. end
  148.  
  149. on gotoMainMenu
  150.   if the frame>marker("quiz") then
  151.     quitToWhere=#main
  152.     sprite(73).member=member("quit quiz caption")
  153.     sprite(70).show()
  154.   else
  155.     puppetTransition("wipe left")
  156.     go "main"
  157.   end if
  158. end
  159.  
  160. on gotoVideo
  161.   puppetTransition("wipe left")
  162.   go "video"
  163. end
  164.  
  165. on gotoQuiz
  166.   prepareQuiz()
  167.   reflashQuiz()
  168.   puppetTransition("wipe left")
  169.   go "quiz"
  170. end
  171.  
  172. on gotoExit
  173.   quitToWhere=#windows
  174.   if the runmode contains "plugin" then
  175.     sprite(73).member=member("close caption")
  176.   else
  177.     sprite(73).member=member("quit caption")
  178.   end if
  179.   sprite(70).show()
  180. end
  181.  
  182. on tryAgain
  183.   quitToWhere=#quiz
  184.   sprite(73).member=member("try again")
  185.   sprite(70).show()
  186. end
  187.  
  188. on quitOrExit
  189.   case quitToWhere of
  190.     #windows:
  191.       if the runmode contains "plugin" then
  192.         gotonetpage "JavaScript:window.close()"
  193.       else
  194.         quit
  195.       end if
  196.     #main:
  197.       sprite(70).hide()
  198.       puppetTransition("wipe left")
  199.       go "main"
  200.     #quiz:
  201.       sprite(70).hide()
  202.       gotoQuiz()
  203.   end case
  204. end
  205.  
  206. on preQues
  207.   curQuesNum=curQuesNum-1
  208.   if curQuesNum<1 then curQuesNum=1
  209.   reflashQuiz()
  210.   sprite(42).showKey()
  211.   puppetTransition("wipe left")
  212. end
  213.  
  214. on nextQues
  215.   curQuesNum=curQuesNum+1
  216.   if curQuesNum>QuestionUsed then curQuesNum=QuestionUsed
  217.   reflashQuiz()
  218.   sprite(42).showKey()
  219.   puppetTransition("wipe right")
  220. end
  221.  
  222. on videoPre step
  223.   put step
  224.   sprite(21).videoPre(step)
  225. end
  226.  
  227. on videoNext step
  228.   put step
  229.   sprite(21).videoNext(step)  
  230. end
  231.  
  232.